package com.iafme.dto.res;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.systemframework.jackson.CustomDecimalSerialize;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;

/**
 * @author summer
 * @version 1.0
 * @date 2025/1/7 17:55
 */
@Data
@SearchBean(tables = " iafme_course c LEFT JOIN  iafme_project p ON c.projectId=p.id " +
        " LEFT JOIN  iafme.iafme_level l on l.id=c.levelId " +
        " LEFT JOIN iafme_showings s ON s.id=c.subjectId",orderBy = "c.createTime DESC")
public class CourserResDTO implements Serializable {

    @DbField("c.id")
    private Integer id;

    @DbField("c.projectId")
    private Integer projectId;

    @DbField("c.levelId")
    private Integer levelId;

    @DbField("c.name")
    private String name;

    @DbField("c.subjectId")
    private Integer showingsId;

    @DbField("c.createTime")
    private LocalDateTime createTime;

    @DbField("p.name")
    private String projectName;

    @DbField("l.name")
    private String levelName;

    @JsonSerialize(using = CustomDecimalSerialize.class)
    @DbField("c.amount")
    private BigDecimal amount;

    @DbField("s.name")
    private String showingsName;

    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DbField("c.courseDate")
    private Date courseDate;

    @DbField("s.city")
    private String city;

    @DbField("c.startTime")
    @JsonFormat(pattern = "HH:mm")
    private Date startTime;

    @DbField("c.endTime")
    @JsonFormat(pattern = "HH:mm")
    private Date endTime;

    @DbField("CONCAT(c.startTime,'-',c.endTime)")
    private String examTime;
}
